//
//  TitleButton.swift
//  WeiBo
//
//  Created by Gao on 16/3/3.
//  Copyright © 2016年 Gao. All rights reserved.
//

import UIKit
//主页标题的按钮
class TitleButton: UIButton
{
    override init(frame: CGRect)
    {
        super.init(frame: frame)
        self.setTitleColor(UIColor.darkTextColor(), forState: .Normal)
        self.titleLabel?.font = UIFont.systemFontOfSize(17)
        self.setImage(UIImage(named: "navigationbar_arrow_down"), forState: .Normal)
        self.setImage(UIImage(named: "navigationbar_arrow_up"), forState: .Selected)
        self.sizeToFit()
    }

    required init?(coder aDecoder: NSCoder)
    {
        fatalError("init(coder:) has not been implemented")
    }
    
    //修正标题和旁边箭头的位置
    override func layoutSubviews()
    {
        super.layoutSubviews()
        titleLabel?.frame.origin.x = 0
        imageView?.frame.origin.x = (titleLabel?.bounds.width)! + 5
    }
    
}
